package LeiandObject;

public class EggCake {
    int eggCount;   //定义一个成员变量

    public EggCake(int eggCount){   //带参数的构造方法
        this.eggCount = eggCount;   //使用this给成员变量赋值
        System.out.println("这个饼里有" + eggCount + "个鸡蛋");
    }

    public EggCake() {  //无参的构造方法
       //eggCount = 1;
       //System.out.println("这个饼里有" + eggCount + "个鸡蛋");
        this(1);    //使用this调用构造方法
    }

    public static void main(String[] args) {
        EggCake e = new EggCake();  //对象初始化
        EggCake e2 = new EggCake(5);
    }
}
